<?php
  session_cache_limiter('private,must-revalide');
   /**
   * 处理上传页面
   */  
  include_once("./config.php");
  $tpl = new PhplibTpl($conf["admin_tpl_path"]);
  
  if ($_POST['type'])
  {
   
	$_POST['type'];
	$title = $_POST['title'];
	$ord = $_POST['ord'];
	$t =$_POST['type'];
	if($ord==''||$title=='')
	{	
		 MyNotice("請輸入完整的信息", 1, "news.php");
		 exit(0);
	}	
    $query = "INSERT INTO $TBL_OPTION (id,title,type,ord) values (NULL,'$title','$t','$ord')";		
    $res = mysql_query($query) or die(mysql_error());
	if($res)
	{
		 MyNotice("選項分類添加成功", 1, "news.php");
		 exit(0);
	}	
		
  } 
  include_once("list_cate.php");
  $time1=date('Y-m-d H:i:s');
  $tpl -> set_file(array("main" => "xx.htm"));
  $tpl -> set_block("main", "NEWS_LIST", "news_list");

  $query = "SELECT * FROM $TBL_OPTION order by ord asc";
  $result = mysql_query( $query ) or die(mysql_error());
  while($rows = mysql_fetch_array( $result))
  { 
		if($rows[type]==1)
		{			
			$show1 =$show1.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==2)
		{			
			$show2 =$show2.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==3)
		{			
			$show3 =$show3.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==4)
		{			
			$show4 =$show4.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==5)
		{			
			$show5 =$show5.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==6)
		{			
			$show6 =$show6.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==7)
		{			
			$show7 =$show7.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==8)
		{			
			$show8 =$show8.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
		if($rows[type]==9)
		{			
			$show9 =$show9.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}

		if($rows[type]==10)
		{			
			$show10 =$show10.$rows['ord']." - ". $rows['title']."&nbsp;&nbsp;&nbsp;<a href='delete.php?id=$rows[id]'>刪除</a><br>";
		}
	  
	  
  } 
  $tpl -> set_var(array(                        
						 "show1" => $show1,
						 "show2" => $show2,
						 "show3" => $show3,
						 "show4" => $show4,
						 "show5" => $show5,
						 "show6" => $show6,
						 "show7" => $show7,
						 "show8" => $show8,
						 "show9" => $show9,
						 "show10" => $show10,
                       ));
  $tpl->set_var($conf);
  $tpl -> parse("Output", "main");
  $tpl -> p("Output");
  exit(0);
?>